package com.shbaiche.bifenba.adapter.my;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.shbaiche.bifenba.R;
import com.shbaiche.bifenba.model.GankResults;
import com.shbaiche.bifenba.model.video.ArticleDiscussVo;
import com.shbaiche.bifenba.util.StringUtil;

import butterknife.BindView;
import cn.droidlover.xdroid.base.SimpleRecAdapter;
import cn.droidlover.xdroid.kit.KnifeKit;

/**
 * Created by wanglei on 2016/12/10.
 */

public class MyCommentListAdapter extends SimpleRecAdapter<ArticleDiscussVo, MyCommentListAdapter.ViewHolder> {


    public MyCommentListAdapter(Context context) {
        super(context);
    }

    @Override
    public ViewHolder newViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }

    @Override
    public int getLayoutId() {
        return R.layout.adapter_my_comment_list;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        ArticleDiscussVo item = data.get(position);

        holder.tvTitle.setText(item.getArticleTitle() + "");
        holder.tvContent.setText(item.getContent() + "");
        long zanNum = 0;
        if (item.getFollowNum() != null)
            zanNum = item.getFollowNum();
        holder.dianzan.setText("赞 " + zanNum);
        try {
            holder.tvTime.setText(StringUtil.getTimeFormatText(StringUtil.strToDateLong(item.getPublishTime())) + "");
        } catch (Exception e) {

        }
        //ILFactory.getLoader().loadNet(holder.ivGirl, item.getUrl(), null);

//        holder.itemView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                if (getRecItemClick() != null) {
//
//                }
//            }
//        });
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.com_time)
        TextView tvTime;

        @BindView(R.id.com_title)
        TextView tvTitle;

        @BindView(R.id.com_content)
        TextView tvContent;

        @BindView(R.id.com_zan)
        TextView dianzan;


        public ViewHolder(View itemView) {
            super(itemView);
            KnifeKit.bind(this, itemView);
        }
    }
}
